﻿using System;
using System.Collections.Generic;

namespace com.fukefu.source
{
    public class UserAgent
    {
        List<string> list_useragent = new List<string>();
        Random random = new Random();

        public UserAgent()
        {
            /*
            List<string> list_os = new List<string>();
            list_os.Add("Windows NT 5.0");//Windows 2000
            list_os.Add("Windows NT 5.1");//Windows XP
            list_os.Add("Windows NT 5.2");//Windows 2003
            list_os.Add("Windows NT 6.0");//Windows Vista
            list_os.Add("Windows NT 6.1");//Windows 7*/
            // IE8 on Windows Vista (兼容浏览)
            list_useragent.Add("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)");
            //IE8 on Windows Vista
            list_useragent.Add("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)");
            //IE8 on Windows 7
            list_useragent.Add("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)");
            //64-bit IE on 64-bit Windows 7:
            list_useragent.Add("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0)");
            //32-bit IE on 64-bit Windows 7:
            list_useragent.Add("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0)");
            //32-bit firefox
            list_useragent.Add("Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1");
            list_useragent.Add("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1");
            list_useragent.Add("Mozilla/5.0 (Windows NT 6.1; rv:10.0a1) Gecko/20111017 Firefox/10.0a1");
            list_useragent.Add("Mozilla/5.0 (Windows NT 5.1; rv:10.0.3) Gecko/20100101 Firefox/10.0.3");
            //遨游
            list_useragent.Add("Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en) Opera 8.0 ");
            //谷歌浏览器
            list_useragent.Add("Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13");
        }
        //获取UserAgent
        public string Get()
        {
            return list_useragent[MyFunction.GetRandom(list_useragent.Count)];
        }
    }
}
